<template>
  <div class="main">
    <el-form class="form" label-width="120">
      <el-form-item label="版本号">
        <el-input placeholder="输入版本号" v-model="setting.version" style="width: 200px"></el-input>
      </el-form-item>
      <el-button class="submit" type="success" @click="submit">提交</el-button>
    </el-form>
  </div>
</template>

<script lang="ts" setup>
import {ref} from "vue";
import {ElMessage} from "element-plus";
import {Setting} from "@/typings";
import {getSetting, saveSetting} from "@/api/system/setting";
import Uploader from "@/components/uploader/uploader.vue";

let setting = ref<Setting>({version: 0, statement: '', appId: 'wxe6cfd750d4eff083'})
let uploader = ref<InstanceType<typeof Uploader>>()
getSetting(setting.value.appId).then(res => {
  if (res) {
    setting.value = res as Setting
  }
})
const submit = () => {
  saveSetting(setting.value).then(res => {
    if (res == true) {
      ElMessage({
        message: '提交成功',
        type: 'success',
      })
    }
  })
}
</script>

<style scoped>
.cover {
  margin-top: 20px;
}

.form {
  width: 400px;
  margin: auto;
}

.submit {
  display: block;
  margin: 20px auto;
}
</style>